home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / xregistered.pro < prev    next >
Text File  |  1997-07-08  |  2KB  |  88 lines

  1. ; $Id: xregistered.pro,v 1.4 1997/01/15 03:11:50 ali Exp $
  2. ;
  3. ; Copyright (c) 1992-1997, Research Systems, Inc.  All rights reserved.
  4. ;    Unauthorized reproduction prohibited.
  5.  
  6.  
  7. function XRegistered, NAME, NOSHOW = NOSHOW
  8. ;+
  9. ; NAME: 
  10. ;    XREGISTERED
  11. ;
  12. ; PURPOSE:
  13. ;    This function returns non-zero if the widget named as its argument 
  14. ;    is currently registered with the XMANAGER as an exclusive widget, 
  15. ;    otherwise this routine returns false.
  16. ;
  17. ; CATEGORY:
  18. ;    Widgets.
  19. ;
  20. ; CALLING SEQUENCE:
  21. ;    Result = XREGISTERED(Name)
  22. ;
  23. ; INPUTS:
  24. ;    Name:    A string containing the name of the widget in question.
  25. ;
  26. ; KEYWORD PARAMETERS:
  27. ;    NOSHOW:    If the widget in question is registered, it is brought
  28. ;        to the front of all the other windows by default.  Set this
  29. ;        keyword to keep the widget from being brought to the front.
  30. ;
  31. ; OUTPUTS:
  32. ;    If the named widget is registered, XREGISTERED returns the number
  33. ;    of instances of that name in the list maintained by XMANAGER.  
  34. ;    Otherwise, XREGISTERED returns 0.
  35. ;
  36. ; COMMON BLOCKS:
  37. ;    MANAGED
  38. ;
  39. ; SIDE EFFECTS:
  40. ;    Brings the widget to the front of the desktop if it finds one.
  41. ;
  42. ; RESTRICTIONS:
  43. ;    None.
  44. ;
  45. ; PROCEDURE:
  46. ;    Searches the list of exclusive widget names and if a match is found
  47. ;    with the one in question, the return value is modified.
  48. ;
  49. ; MODIFICATION HISTORY:
  50. ;    Written by Steve Richards, November, 1990
  51. ;    Jan, 92 - SMR    Fixed a bug where an invalid widget
  52. ;            was being referenced with 
  53. ;            WIDGET_CONTROL and the /SHOW keyword.
  54. ;    17 November 1993 - AB and SMR. Added ID validity checking to
  55. ;            fix a bug where already dead widgets were being
  56. ;            accessed.
  57. ;    Apr, 96 - DJE    Rewrite for asynchronous widget event handling.
  58. ;-
  59.  
  60.   COMMON managed,    ids, $        ; IDs of widgets being managed
  61.               names, $    ; and their names
  62.             outermodal    ; list of active modal widgets
  63.  
  64.   FORWARD_FUNCTION    LookupManagedWidget
  65.  
  66.   ; If no widgets are being managed, we're done. (This also handles the case
  67.   ; where XMANAGER hasn't been compiled yet.)
  68.   IF (NOT keyword_set(ids)) THEN $
  69.     return, 0
  70.  
  71.   answer = 0
  72.   
  73.   ; look for the named widget
  74.   id = LookupManagedWidget(name)
  75.   IF (id NE 0L) THEN BEGIN
  76.     ; bring the widget to the front
  77.     IF (NOT keyword_set(noshow)) THEN $
  78.       widget_control, id, /show
  79.  
  80.     ; return the count of widgets with the given name
  81.     tmp = where(names EQ name, answer)
  82.   ENDIF
  83.  
  84.   RETURN, answer
  85.  
  86. END
  87.  
  88.